Implement Chicory WASM backend for the Ruby API#4017
Implement Chicory WASM backend for the Ruby API#4017
Conversation
|
This depends upon changes in #3944 and will be rebased once that merges to main. |
|
I wonder if it'd make sense to support the WASM case in |
Yes, that's why it's a draft. |
afd64c3 to
1b02ef4
Compare
Rather than templating two versions of sources with and without non-semantic fields, we can make that determination at build time. Passing -DPRISM_SERIALIZE_ONLY_SEMANTICS_FIELDS=1 to `make` will force that variable to be literally true, and the compiler will eliminate `if` blocks that use it to conditionally serialize non- semantic data. This simplifies the templates by removing that variation and allows building both forms of the library from a single generated set of sources.
|
Most recent commit is an attempt to move the The JVM WASM builds need to take two forms:
These two artifacts should be sibling modules under
But because the templated sources must be generated twice, once for semantic-only and again for non-semantic, the build process ends up being much more complicated:
By moving the semantic-only flag into a C macro, a single set of sources can be generated and customized at C compile time, allowing a single make target to build both WASM forms. Ideally the other two major C templating flags could also move into build-time macros:
Really, the only tricky part is for the Java API that has two forms: with node ID and without node ID, and I think we can handle that a different way (perhaps by adding another flag to the serialization header?) |
templates/java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java.erb
Outdated
Show resolved
Hide resolved
Only used while testing the FFI backend on CRuby.
This PR will provide a new Ruby API backend (in addition to the C extension and the FFI wrapper) based on the Chicory WASM runtime for the JVM.
This version of the gem will be published for JRuby users as the default cross-platform gem. Future gems will make platform-specific binary builds available for users that desire the additional performance.
The goal here is to get a native-code free version of the prism gem released for JRuby users.